#ifndef __SINGLETON_H__
#define __SINGLETON_H__

#include <iostream>
using std::cout;
using std::endl;

template <class T> 
class TSingleton
{
public:

	static T * Instance()
	{
		static T obj;
		return &obj;
	}

private:
	TSingleton() {}
	~TSingleton() {}

};

#define SINGLETON(T) protected:friend class TSingleton< T >;T(){};  
#define SINGLETONINSTANCE(T) TSingleton< T >::Instance()
#endif // __SINGLETON_H__